package com.liujit.bms.admin.controller;

import com.liujit.bms.admin.domain.params.BlogArticleCommentParams;
import com.liujit.bms.admin.domain.query.BlogArticleCommentQuery;
import com.liujit.bms.admin.domain.result.BlogArticleCommentResult;
import com.liujit.bms.admin.service.BlogArticleCommentService;
import com.liujit.common.domain.params.BaseParams;
import com.liujit.common.domain.result.PageBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description 博客文章评论管理接口
 * @Author liujun
 * @Date 2021-07-19 11:16:42
 */
@RequiredArgsConstructor
@Api(tags = "博客文章评论管理接口")
@RestController
@RequestMapping("/blog/article/comment")
public class BlogArticleCommentController {

    private final BlogArticleCommentService blogArticleCommentService;

    @ApiOperation(value = "分页查询", notes = "根据博客文章评论分页查询条件，分页查询博客文章评论列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "query", value = "博客文章评论分页查询条件", dataType = "BlogArticleCommentQuery", dataTypeClass = BlogArticleCommentQuery.class, paramType = "query") })
    @GetMapping("/getPage")
    public PageBean<BlogArticleCommentResult> getPage(BlogArticleCommentQuery query) {
        return blogArticleCommentService.getPage(query);
    }

    @ApiOperation(value = "回复", notes = "根据博客文章评论回复请求参数，回复博客文章评论")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "params", value = "博客文章评论回复请求参数", dataType = "BlogArticleCommentParams", dataTypeClass = BlogArticleCommentParams.class, paramType = "body") })
    @PostMapping("/reply")
    public Boolean modify(@RequestBody @Validated BlogArticleCommentParams params) {
        return blogArticleCommentService.reply(params);
    }

    @ApiOperation(value = "查询", notes = "根据博客文章评论id，查询博客文章评论")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "博客文章评论id", dataType = "Long", dataTypeClass = Long.class, paramType = "query") })
    @GetMapping("/get")
    public BlogArticleCommentResult get(Long id) {
        return blogArticleCommentService.get(id);
    }

    @ApiOperation(value = "查询", notes = "根据博客文章评论id，查询博客文章评论")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "博客文章评论id", dataType = "Long", dataTypeClass = Long.class, paramType = "query") })
    @GetMapping("/getDetail")
    public BlogArticleCommentResult getDetail(Long id) {
        return blogArticleCommentService.getDetail(id);
    }

    @ApiOperation(value = "删除", notes = "根据博客文章评论删除请求参数，删除博客文章评论")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "params", value = "博客文章评论删除请求参数", dataType = "BaseParams", dataTypeClass = BaseParams.class, paramType = "body") })
    @PostMapping("/del")
    public Boolean del(@RequestBody BaseParams params) {
        return blogArticleCommentService.del(params);
    }
}
